package net.dodoman.thread.ticket;

/**
 * 卖票线程
 * 
 * @author yanping
 * 
 */
public class SalesThread extends Thread {
	private TicketMachine ticketMachine;
	private String name;

	public SalesThread(TicketMachine ticketMachine, String name) {
		this.ticketMachine = ticketMachine;
		this.name = name;
	}

	@Override
	public void run() {
		while (!ticketMachine.isSoldOut()) {
			System.out.println(name + " is working");
			ticketMachine.sale();
		}
	}

}
